package com.webchat.aigc.controller;

import com.webchat.aigc.llm.LlmChatService;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.domain.dto.aigc.ChatCompletionMessageRequest;
import com.webchat.rmi.aigc.LLMChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RefreshScope
@RestController
public class LLMChatController implements LLMChatClient {


    @Autowired
    private LlmChatService llmChatService;

    @Override
    public APIResponseBean<String> chat(@RequestBody ChatCompletionMessageRequest chatCompletionMessage) {

        String content = llmChatService.chat(chatCompletionMessage);
        return APIResponseBeanUtil.success(content);
    }
}
